﻿Imports extranet.BE
Imports extranet.DA

Public Class BCCurso

  Public Shared Sub Cadastrar(ByVal objBECurso As BECurso)
    Dim objDACurso As New DACurso
    objDACurso.Cadastra(objBECurso)
  End Sub

  Public Shared Sub Atualizar(ByVal objBECurso As BECurso)
    Dim objDACurso As New DACurso
    objDACurso.Atualiza(objBECurso)
  End Sub

  Public Shared Sub RelacionaCursoProva(ByVal objBECurso As BECurso)
    Dim objDACurso As New DACurso
    objDACurso.RelacionaCursoProva(objBECurso)
  End Sub

  Public Shared Sub Excluir(ByVal objBECurso As BECurso)
    Dim objDACurso As New DACurso
    objDACurso.Exclui(objBECurso)
  End Sub

  Public Shared Function Selecionar(ByVal intIdCurso As Integer) As List(Of BECurso)
    Dim objDACurso As New DACurso()
    Return objDACurso.Seleciona(New BECurso(intIdCurso))
  End Function

  Public Shared Function Selecionar(ByVal strCurso As String, ByVal intAtivo As Integer, _
                                    ByVal sortExpression As String, ByVal sortDirection As String) As List(Of BECurso)
    Dim objDACurso As New DACurso
    objDACurso.objQuery.Sort = New BESort(sortExpression, sortDirection)
    Dim objBECurso As New BECurso()
    objBECurso.Titulo = strCurso
    objBECurso.Ementa = strCurso
    objBECurso.Ativo = intAtivo
    Return objDACurso.Seleciona(objBECurso)
  End Function

  Public Shared Function SelecionarCursosDisponiveis(ByVal strCurso As String, ByVal strAluno As String, _
                                                     ByVal sortExpression As String, ByVal sortDirection As String) As List(Of BECurso)
    Dim objDACurso As New DACurso
    objDACurso.objQuery.Sort = New BESort(sortExpression, sortDirection)
    Dim objBECurso As New BECurso()
    objBECurso.Titulo = strCurso
    objBECurso.Ementa = strCurso
    objBECurso.Ativo = 1
    objBECurso.Alunos = New List(Of BEAluno)
    objBECurso.Alunos.Add(New BEAluno(strAluno))
    Return objDACurso.SelecionaCursosDisponiveis(objBECurso)
  End Function

  Public Shared Function SelecionarCursosDoAluno(ByVal strCurso As String, ByVal strAluno As String, _
                                                 ByVal sortExpression As String, ByVal sortDirection As String) As List(Of BECurso)
    Dim objDACurso As New DACurso
    objDACurso.objQuery.Sort = New BESort(sortExpression, sortDirection)
    Dim objBECurso As New BECurso()
    objBECurso.Titulo = strCurso
    objBECurso.Ementa = strCurso
    objBECurso.Ativo = 1
    objBECurso.Alunos = New List(Of BEAluno)
    objBECurso.Alunos.Add(New BEAluno(strAluno))
    Return objDACurso.Seleciona(objBECurso)
  End Function

  Public Shared Sub AdicionarAluno(ByVal intIdCurso As Integer, ByVal strAluno As String)
    Dim objDACurso As New DACurso
    Dim objBECurso As New BECurso(intIdCurso)
    objBECurso.Alunos = New List(Of BEAluno)
    objBECurso.Alunos.Add(New BEAluno(strAluno))
    objDACurso.AdicionarAlunos(objBECurso)
  End Sub

  Public Shared Sub RemoverAluno(ByVal intIdCurso As Integer, ByVal strAluno As String)
    Dim objDACurso As New DACurso
    Dim objBECurso As New BECurso(intIdCurso)
    objBECurso.Alunos = New List(Of BEAluno)
    objBECurso.Alunos.Add(New BEAluno(strAluno))
    objDACurso.RemoverAlunos(objBECurso)
  End Sub

End Class